home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
xlib
/
yicons24
/
source
/
mapedit.dsk
< prev
next >
Wrap
Text File
|
1993-03-05
|
3KB
|
117 lines
eat
Color := RandColor;
SetColor(Color);
SetFillStyle(Random(CloseDotFill)+1, Color);
Bar3D(Random(MaxWidth), Random(MaxHeight),
Random(MaxWidth), Random(MaxHeight), 0, TopOff);
until KeyPressed;
WaitToGo;
end; { RandBarPlay }
procedure ArcPlay;
{ Draw random arcs on the screen }
var
MaxRadius : word;
EndAngle : word;
ArcInfo : ArcCoordsType;
begin
MainWindow('Arc / GetArcCoords demonstration');
StatusLine('Esc aborts or press a key');
MaxRadius := MaxY div 10;
repeat
SetColor(RandColor);
EndAngle := Random(360);
SetLineStyle(SolidLn, 0, NormWidth);
Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
GetArcCoords(ArcInfo);
with ArcInfo do
begin
Line(X, Y, XStart, YStart);
Line(X, Y, Xend, Yend);
end;
until KeyPressed;
WaitToGo;
end; { ArcPlay }
procedure PutPixelPlay;
{ Demonstrate the PutPixel and GetPixel commands }
const
Seed = 1962; { A seed for the random number generator }
NumPts = 2000; { The number of pixels plotted }
Esc = #27;
var
I : word;
X, Y, Color : word;
XMax, YMax : integer;
ViewInfo : ViewPortType;
begin
MainWindow('PutPixel / GetPixel demonstration');
StatusLine('Esc aborts or press a key...');
GetViewSettings(ViewInfo);
with ViewInfo do
begin
XMax := (x2-x1-1);
YMax := (y2-y1-1);
end;
while not KeyPressed do
begin
{ Plot random pixels }
RandSeed := Seed;
I := 0;
while (not KeyPressed) and (I < NumPts) do
begin
Inc(I);
PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
end;
{ Erase pixels }
RandSeed := Seed;
I := 0;
while (not KeyPressed) and (I < NumPts) do
begin
Inc(I);
X := Random(XMax)+1;
Y := Random(YMax)+1;
Color := GetPixel(X, Y);
if Color = RandColor then
PutPixel(X, Y, 0);
end;
end;
WaitToGo;
end; { PutPixelPlay }
procedure PutImagePlay;
{ Demonstrate the GetImage and PutImage commands }
const
r = 20;
StartX = 100;
StartY = 50;
var
CurPort : ViewPortType;
procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
var
Step : integer;
begin
Step := Random(2*r);
if Odd(Step) then
Step := -Step;
X := X + Step;
Step := Random(r);
if Odd(Step) then
Step := -Step;
Y := Y + Step;
{ Make saucer bounce off viewport walls }
with CurPort do
begin
if (x1 + X + Width - 1 > x2) then
X := x2-x1 - Width + 1
else
if (X < 0) then
X := 0;
if (y1 + Y + Height - 1 >